const router = require('koa-router')();
router.prefix(appConfig.authPrefixUrl+'/desktop/robot');
const ResultVo = appRequire('vo/ResultVo.js');

router.get('/index',async(ctx)=>{
  ctx.body="sys_robot 你好";
});

router.post('/send',async(ctx)=>{
  try{
    console.log(ctx.request.body);
    let pObj = ctx.request.body;
    console.log(pObj);
    ctx.body = ResultVo.success('success',pObj);
      // ctx.body=ResultVo.error(1,'error','登录失败!');
  }catch(err){
    //集中处理错误
    err.msg = "数据信息后台机器人发送失败!";
    ctx.app.emit('error', err, ctx);
  }
});

router.get('/send',async(ctx)=>{
  try{
    let pObj = ctx.query;
    console.log(pObj);
    ctx.body = ResultVo.success('success',pObj);
  }catch(err){
    //集中处理错误
    err.msg = "数据信息后台机器人发送失败!";
    ctx.app.emit('error', err, ctx);
  }
});
module.exports = router;